<template>
	<view class="getOrder">
		<view style="padding-top:50rpx" v-if="orderList.length==0">
			数据为空
		</view>
		
		<template v-else>
			<view class="order-holder" v-for="item in orderList" :key="item.order.id">
				<view class="order-info">
					<text>订单编号{{item.order.id}}</text>
					<text>已收货</text>
				</view>
				<view class="list">
					<view class="item" v-for="item1 in item.items" :key="item1.id">
						<image class="img" :src="item1.productPic" mode=""></image>
			
						<view class="right">
							<view class="name">
								<text>{{item1.productName}}</text>
								<text>￥{{item1.productPrice}}</text>
							</view>
			
							<view class="count">
								<text>编号：{{item1.productSkuId}}</text>
								<text>x{{item1.productQuantity}}</text>
							</view>
			
							<view class="type">
								<text>规格：</text>
								<text v-for="item2 in JSON.parse(item1.productAttr)">{{item2.key}}:{{item2.value}} </text>
							</view>
						</view>
					</view>
				</view>
			
				<view class="sum-price">
					<view class="sum">
						<text>时间：{{item.order.createTime}}</text>
						<text>合计：￥{{item.order.totalAmount}}元</text>
					</view>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	import {
		requestPreOrder,
		requestCancelOrder
	} from 'api/user/order.js';
	export default {
		props: ['orderList'],
		data() {
			return {

			};
		},
		created() {
			console.log(this.orderList);
		}
	}
</script>

<style lang="scss" scoped>
	.getOrder {
		box-sizing: border-box;
		padding: 40rpx;
		width: 100%;

		.order-holder {
			box-sizing: border-box;
			margin: 30rpx 0;
			padding: 36rpx;
			border-radius: 24rpx;
			background-color: #fff;
			overflow: hidden;

			.order-info {
				display: flex;
				padding-bottom: 20rpx;
				justify-content: space-between;
				font-size: 24rpx;
				border-bottom: 1px solid #f1ece7;
			}

			.list {
				.item {
					box-sizing: border-box;
					padding: 30rpx 0;
					display: flex;
					align-items: center;
					width: 100%;
					border-bottom: 1px solid #f1ece7;

					.img {
						width: 162rpx;
						height: 162rpx;
					}

					.right {
						margin-left: 30rpx;
						flex: 1;

						.name {
							font-size: 13px;
							line-height: 37px;
							display: flex;
							justify-content: space-between;
						}

						.count {
							display: flex;
							justify-content: space-between;
							font-size: 22rpx;
							color: #8d8d8d;
							line-height: 30rpx;
							margin-top: 4rpx;
						}
					}
				}
			}

			.sum-price {
				float: right;
				width: 100%;
				margin-top: 20rpx;

				.sum {
					display: flex;
					justify-content: space-between;
				}

				.submit-btn {
					margin-left: 32rpx;
					margin-top: 20rpx;
					float: right;
					width: 124rpx;
					height: 50rpx;
					font-size: 26rpx;
					border: 2rpx solid #2d4f43;
					text-align: center;
					color: #2d4f43;
					border-radius: 10rpx;
					line-height: 50rpx;
				}
			}
		}
	}
</style>


